<?php

namespace App\Http\Requests\Api;



use Dingo\Api\Http\FormRequest;

class RegisterRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'email'=>'required|email|unique:users,email',
            'name'=>'required|unique:users,name|regex:/^[0-9a-zA-Z]{3,20}$/',
            'password' => 'required|regex:/^[0-9a-zA-Z]{6,20}$/|confirmed',
            'password_confirmation' => 'required|regex:/^[0-9a-zA-Z]{6,20}$/|same:password',
        ];
    }
}
